// pages/detail-list/detail-list.js
var app = getApp()
//常量数据配置
var ConstantData = require('../../../../../common/constant_data.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.phone = options.phone;
    this.data.key = options.key;
    this.getApgeLeaseRecord();
    // let list = [
    //   {
    //     title:"苏州阳光护理院制氧机",
    //     status:"1",
    //     useTime:"- -分钟",
    //     totalTime:"60分钟",
    //     orderId:"2021050920302002333",
    //     time:"-",
    //     fee:"0元",
    //     image:"http://localhost:8081/images/210-item-image.jpg",
    //     icon:"http://localhost:8081/images/detail-icon.png"
    //   },
    //   {
    //     title:"苏州阳光护理院制氧机",
    //     status:"2",
    //     useTime:"59分钟",
    //     totalTime:"60分钟",
    //     orderId:"2021050920302002333",
    //     time:"2021-04-16 12:22至2021-04-13:22",
    //     fee:"0元",
    //     image:"http://localhost:8081/images/210-item-image.jpg",
    //     icon:"http://localhost:8081/images/detail-icon.png"
    //   },
    //   {
    //     title:"苏州阳光护理院制氧机",
    //     status:"0",
    //     useTime:"0分钟",
    //     totalTime:"60分钟",
    //     orderId:"2021050920302002333",
    //     time:"2021-04-16 12:22至2021-04-13:22",
    //     fee:"0元",
    //     image:"http://localhost:8081/images/210-item-image.jpg",
    //     icon:"http://localhost:8081/images/detail-icon.png"
    //   }
    // ];
    // this.setData({list:list});
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  /**
   * 查看护工的租赁记录
   */
  getApgeLeaseRecord: function () {
    var that = this
    var phone = this.data.phone

    app.executeRequest(function (header) {

      wx.request({
        url: ConstantData.CONSTATNT_DATA.BASE_URL + '/hospitalAdmin/powerUseRecordList',
        header: header,
        data: {
          key: that.data.key,
          phone: phone,
          numPerPage: that.data.numPerPage,
          pageNum: that.data.pageNum
        },
        success: function (res) {
          var result = res.data
          var rst = result.result
          if (rst == 0) {
            let list = res.data.data.data;
            //获取成功
            that.setData({
              list:list
            });
          } else {
            wx.showToast({
              title: result.description,
            })
          }
        },
        fail: function () {
          wx.showToast({
            title: '稍后重试',
          })
        }
      })

    })
    
  }




})